<?php
/**
 * Author: Administrator
 * Date: 2022/7/15 2:46
 */

namespace DesignPatterns\Creation\FactoryMethod;


class GermanFactory extends FactoryMethod
{

    protected function createVehicle($type)
    {
        switch ($type) {
            case self::SLOW: {
                return new Bicycle();
            }
            case self::FAST: {
                $obj = new Porsche();
                $obj->addTuningAMG();
                return $obj;
            }
            default:
            throw new \InvalidArgumentException("$type is not a valid vehicle");
        }
    }
}